import argparse
import os


def parse_args():
    parse = argparse.ArgumentParser()
    parse.add_argument("file", type=str, help="文件路径")
    parse.add_argument("n", type=int, help="删除前n个字符")

    args = parse.parse_args()
    return vars(args)


params = parse_args()
file = params.get('file')
if not os.path.isfile(file):
    raise Exception('{} is not exist'.format(file))

with open(file, 'r', encoding='UTF-8') as f:
    content = f.readlines()

n = params.get('n') - 1
new_content = [line[n:] for line in content]

print(new_content)

new_file = file + '.txt'

with open(new_file, 'w') as f:
    f.writelines(new_content)
